;:sys36864
	;.opt oo
	*= 51200
loadvec	=$330
loadold	=$f4a5
strout	=$ab1e
axout	=$bdcd
love	=$93
status	=$90
ga	=$ba
missing	=$f710
fnlen	=$b7
mem	=$ae
adr	=$c3
talk	=$ed09
second	=$edc7
sa	=$b9
iecin	=$ee13
return	=$aad7
message	=$f5d2
search	=$f5af
openfile	=$f3d5
stopkey	=$ffe1
setst	=$fe1c
fileclose	=$f633
ende	=$f5a9
nofound	=$f704
untalk	=$edef
close	=$f642
bsout	=$e716
getin	=65508
	lda #<nssload
	ldy #>nssload
	sta loadvec
	sty loadvec+1
	lda #<nss
	ldy #>nss
	jmp strout
nss	.byte "\x05\x12nss verify support by nh 090286"
	.byt 13
	.byte "2nd, revised version 200786\x11\x11"
	.byt 13
	.byte "3nd, revised version 311086\x11\x11"
	.byt 13,0
hexz	.byte "0123456789abcdef"
falsch	.byt 13
	.byte "unterschied in "
	brk
hext	.byte " = $"
	brk
te1	.byt 13
	.byte "\x11\x12fertig. ergebnis:"
	.byt 13
	.byte "\x11 gleich:      \x12"
	.byt 0
te2	.byt 13
	.byte " verschieden: \x12"
	.byt 0
te3	.byte "\x92 bytes.\x11"
	.byt 13,0
gx1	.byt 13
	.byte "   im speicher: $"
	brk
gx2	.byte " - auf disk: $"
	brk
hang	.byt 13
	.byte "nss verify support macht mit !\x11"
	.byt 13
	.byte "unterschiede ausgeben ? [j/n] \x12"
	.byt 0
fa	.word 0
ri	.word 0
flag	brk
worth	brk
nssload	cmp #0
	bne verify
old	jmp loadold
verify	sta love
	lda #<hang
	ldy #>hang
	jsr strout
	lda #0
	sta ri
	sta ri+1
	sta fa
	sta fa+1
	sta status
	jsr ask
	lda ga
	cmp #4
	bcc old
	ldy fnlen
	bne nonull
	jmp missing
nonull	ldx #sa
	jsr search
	lda #$60
	sta sa
	jsr openfile
	lda ga
	jsr talk
	lda sa
	jsr second
	jsr iecin
	sta mem
	lda status
	lsr
	lsr
	bcc notimeout
	jmp timeout
notimeout	jsr iecin
	sta mem+1
	txa
	bne seknonu
	lda adr
	sta mem
	lda adr+1
	sta mem+1
seknonu	jsr message
	jsr return
weiter	lda #$fd
	and status
	sta status
	jsr stopkey
	bne nostop
	jmp fileclose
nostop	jsr iecin
	tax
	lda status
	lsr
	lsr
	bcs weiter
	txa
	ldy #0
	cmp (mem),y
	beq richtig
	sta worth
	inc fa
	bne noi
	inc fa+1
noi	lda #$10
	jsr setst
	lda #<falsch
	ldy #>falsch
	jsr strout
	ldx mem
	lda mem+1
	jsr axout
	lda #<hext
	ldy #>hext
	jsr strout
	lda mem+1
	jsr hexout
	lda mem
	jsr hexout
	jsr outit
	jmp conti
richtig	inc ri
	bne conti
	inc ri+1
conti	inc mem
	bne noinc
	inc mem+1
noinc	bit status
	bvc weiter
	jsr untalk
	jsr close
	bcc ausklang
timeout	jmp nofound
ausklang	lda #<te1
	ldy #>te1
	jsr strout
	lda ri+1
	ldx ri
	jsr axout
	lda #<te2
	ldy #>te2
	jsr strout
	lda fa+1
	ldx fa
	jsr axout
	lda #<te3
	ldy #>te3
	jsr strout
	jmp ende
hexout	pha
	lsr
	lsr
	lsr
	lsr
	jsr hex2
	pla
hex2	and #$f
	tax
	lda hexz,x
	jmp bsout
ask	jsr getin
	cmp #"j"
	beq ja
	cmp #"n"
	bne ask
	jsr bsout
	lda #0
	beq set
ja	jsr bsout
set	sta flag
	jmp return
outit	lda flag
	bne doit
	rts
doit	lda #<gx1
	ldy #>gx1
	jsr strout
	ldy #0
	lda (mem),y
	jsr hexout
	lda #<gx2
	ldy #>gx2
	jsr strout
	lda worth
	jsr hexout
	jmp return
